package com.team11.server.controller.teacher;


import com.team11.server.pojo.dto.RespBean;
import com.team11.server.pojo.dto.RespPageBean;
import com.team11.server.service.IMScoreService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author pjc
 * @since 2021-07-08
 */
@CrossOrigin
@RestController
@RequestMapping("/teacher")
@Api(tags = "教师接口")
public class TeacherMScoreController {

    @Resource
    private IMScoreService imScoreService;

    @ApiOperation("综合评分-->个人评分：获取个人评分列表(分页)")
    @GetMapping("/getMScoreList")
    public RespPageBean getMScoreList(@RequestParam(defaultValue = "1") Integer currentPage,
                                      @RequestParam(defaultValue = "10") Integer size,
                                      String pName, String kcName
    ) {
        return imScoreService.getMScoreList(currentPage, size,pName, kcName);
    }

    @ApiOperation("综合评分-->个人评分：获取个人综合评分详情+个人作业详情")
    @PostMapping("getMScoreDetails")
    public RespPageBean getMScoreDetails(@RequestParam(defaultValue = "1") Integer currentPage,
                                         @RequestParam(defaultValue = "10") Integer size,
                                         @RequestParam("m_id") Integer mId,
                                         @RequestParam("type") Integer type) {

        //type=0是只查看日常作业，为其他的是查看所有作业
        return imScoreService.getMScoreDetails(currentPage, size, mId,type);
    }


    @ApiOperation("综合评分-->个人评分：老师个人进行综合打分")
    @PostMapping("/ComprehensiveScore")
    public RespBean ComprehensiveScore(@RequestParam("m_id") Integer mId,
                                       @RequestParam("tJobNumber") String tJobNumber, @RequestParam("tId") Integer tId,
                                       @RequestParam("mScore") String mScore, @RequestParam("mContent") String mContent) {
        return imScoreService.ComprehensiveScore(mId,tJobNumber, tId, mScore, mContent);
    }
}
